package org.firebug.spring.boot.kafka.controller;

import org.apache.catalina.connector.Response;
import org.firebug.spring.boot.kafka.service.KafkaService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value={"/kafka"})
public class KafkaController {
    @Resource
    private KafkaService kafkaService;

    @RequestMapping(value={"/produce"}, method = {RequestMethod.GET})
    public int produce(String topic, String msg){
        kafkaService.produce(topic, msg);
        return Response.SC_OK;
    }
}
